<?php


namespace app\common\model;


class AddressModel extends CommonModel
{
    protected $name = 'address';

    public function getIsDefaultAttr($v): bool
    {
        return $v === 1;
    }

    public function setIsDefaultAttr($v): int
    {
        return $v === true ? 1 : 0;
    }

    public function getAddressList($where = []): \think\Collection
    {
        return $this->with([])->order([
            'create_time' => 'desc',
        ])->where($where)->select();
    }

    public function getAddress($where = [])
    {
        return $this->with([])->where($where)->find();
    }
}